Execution Flow blocks

Execution Flow blocks allow to switch sections of a program during its execution among a set of pre-configured options.

../../../_images/execution_flow_false.PNG
../../../_images/execution_flow_true.PNG

Execution flow blocks

Execution flow blocks are divided into 2 different types of blocks: On focus block and Switch blocks.

On focus block

The On Focus block outputs a boolean value, which is only True the first time the block is executed.

../../../_images/execution_flow_on_focus.png

On focus block

  • If used inside a Switch Block, the value will be True each time the case is selected.

  • On Focus can be used to trigger actions or initialize variables whenever a case is switched.

The following example would initialize User Variable 01 to 7 whenever Landing phase is selected:

../../../_images/execution_flow_on_focus_example.gif

On focus block example

Swith blocks

  • If-Else Switch block: Choose between two cases based on the state of a boolean variable.

    ../../../_images/execution_flow_if_else.png

    If/Else switch block

    It is possible to swap the blocks of each case (False/True) by simply right-clicking inside an if/else switch block and selecting ‘Invert’.

    ../../../_images/execution_flow_if_else_invert.gif

    Invert created blocks

  • Integer Switch block: Choose a case based on the value of an integer variable.

    ../../../_images/execution_flow_integer.png

    Integer switch block

    Right click on the Integer switch block to access the configuration options:

    • Add Case: Create a new empty case.

    • Copy Case: Create a copy of the current case.

    • Delete Case: Delete the current case.

    • Add Entry: Add a new entry to the current case. An entry is a condition under which the case will be selected. The same entry can on only be in one case at a time. Adding an entry that already exists will move said entry to the current case.

    • Delete Entry: Remove an entry from the current case.

    • Set as Default case: The Default case will be executed whenever the switch condition does not match any of the existing entries.

  • Phase Switch block: Same as Integer Switch, but using Flight Phases as the switch condition.

    ../../../_images/execution_flow_phase.png

    Phase switch block

Warning

Phase Switch and Integer Switch Blocks will report a ‘PDI ERROR’ if they don’t have at least 1 case with entries.

Use of switch blocks

  • Add blocks inside: Drag and drop the desired block inside the Switch block:

    ../../../_images/execution_flow_add_block.gif

    Create a block inside a switch block

  • Input/Output: Right click inside a Switch block and select add Input/Output. To remove them, right click and select Remove Input/Output:

    ../../../_images/execution_flow_input_output.gif

    Add/Remove an input/output of a switch block

Note

The size of a switch block depends on the blocks it contains. A switch block will always have the size of the biggest of its existing cases.